import { ref, reactive } from "vue"
import { defineStore } from "pinia"
// import getRoutes from "@/router/dynamicRoutes"
import staticRoutes from "@/router/staticRoutes"

export const useAuthStore = defineStore("auth", () => {
  const routes = ref<any[]>([])
  let auth: { [key: string]: boolean } = reactive({})

  function setAuth(data: any) {
    data.forEach((key: string) => {
      auth[key] = true
    })
  }

  function setRoutes() {
    routes.value = staticRoutes
  }

  return { routes, auth, setAuth, setRoutes }
})